/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.andersen.web.service;

import com.andersen.database.dao.EmployeeDao;
import com.andersen.database.entity.EmployeeEntity;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Corvus 11
 */
@Service
public class EmployeeDetailsService {

    public static final boolean SORT_DIRECTION_ASC = true;
    public static final boolean SORT_DIRECTION_DESC = false;

    public static final int FILTER_DISCHARGED_ALL = 0;
    public static final int FILTER_DISCHARGED_WORKING = 1;
    public static final int FILTER_DISCHARGED_DISCHARGED = 2;
    
    private static final Logger LOG = Logger.getLogger(CustomUserDetailsService.class);
	
    @Autowired
    private EmployeeDao dao;
    
    public long saveEmployee(EmployeeEntity employee) {
        return dao.insertEmployee(employee);
    }

    public long updateEmployee(EmployeeEntity employee) {
        return dao.updateEmloyee(employee);
    }
    
    public EmployeeEntity getEmployee(long id) {
        return dao.getEmployee(id);
    }

    public ArrayList<EmployeeEntity> getQueryEmployees(int from_item, int count, int sort_by, boolean sort_order,boolean discharge) {

        ArrayList<EmployeeEntity> employees = dao.getQueryEmployees(from_item, count, sort_by, sort_order, discharge);

        return employees;
    }

    public long getEmployeeCount() {
        return dao.getEmployeeCount();
    }
    
    public ArrayList<EmployeeEntity> getEmployeesForAccounts(long officeId){
        return dao.getEmployeesForAccounts(officeId);
    }

    public boolean dischargeEmployee(long id){

        return dao.dischargeEmployee(id);
    }
    
    public ArrayList<EmployeeEntity> getWorkingEmployees(long officeId){
        return dao.getWorkingEmployees(officeId);
    }

    public List<EmployeeEntity> getManagerList(){
        return dao.getManagerList();
    }
}

